package com.gome.ocean.service.datax;

import java.util.List;

import com.github.pagehelper.Page;
import com.gome.ocean.common.exception.DatasourceServiceException;
import com.gome.ocean.dao.model.datasource.DatasourceBO;

public interface DatasourceService {

    boolean insertDatasourceBO(DatasourceBO datasourceBO) throws DatasourceServiceException;

    boolean removeDatasourceBOById(Long id) throws DatasourceServiceException;

    boolean updateDatasourceBOById(DatasourceBO datasourceBO) throws DatasourceServiceException;

    DatasourceBO findDatasourceBOById(Long id);

    List<DatasourceBO> findDataSourceByType(String type);

    List<DatasourceBO> findDataSourceByTypeAndProjectNames(String type,
                                                           List<String> projectNames) throws DatasourceServiceException;

    List<DatasourceBO> findAllDataSource();

    Page<DatasourceBO> findDataSources(Integer pageNum, Integer pageSize) throws DatasourceServiceException;

    Page<DatasourceBO> findAllDatasourceBOsByProjectNames(List<String> projectNames, Integer pageNum, Integer pageSize);

    Page<DatasourceBO> findDataSourcesByUser(String createUser, Integer pageNum,
                                             Integer pageSize) throws DatasourceServiceException;

    List<DatasourceBO> findDataSourcesByUserAndType(String createUser, String type);

    List<DatasourceBO> findDataSourcesByProjectNamesAndType(List<String> projectNames, int type);

    List<DatasourceBO> findDataSourcesByBeloneToCurrentUserProjects(List<String> projectNames);

    DatasourceBO findDatasourceBOByTypeAndUrl(String sourceType, String jdbcUrl);
}
